package com.wit.witmg.api;


import com.wit.witmg.service.ITProdprocService;
import com.wit.witmg.service.ITProdstatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bob
 * @since 2025-01-09
 */
@RestController
@RequestMapping("prodstat")
@Api(tags = "工序统计API")
public class ProdstatController {

    @Resource
    private ITProdstatService service;

    @ApiOperation("添加")
    @PostMapping("add")
    public Object add(HttpServletRequest request,
                      @RequestParam("json") String json) {
        return service.add(request,json);
    }

    //参数：bn模糊匹配返回数组；id返回单条数据
    @ApiOperation("获取")
    @PostMapping("get")
    public Object get(HttpServletRequest request,
                      @RequestParam(value = "pid",required = false) Integer pid,
                      @RequestParam(value = "eid",required = false) Integer eid,
                      @RequestParam(value = "oid",required = false) Integer oid,
                      @RequestParam(value = "eqbn",required = false) String eqbn,
                      @RequestParam(value = "bn",required = false) String bn) {
        return service.get(request,pid,eid,oid,eqbn,bn);
    }

    @ApiOperation("删除")
    @PostMapping("del")
    public Object del(HttpServletRequest request,
                      @RequestParam("id") Integer id) {
        return service.del(request,id);
    }

}
